Imports Gen = System.Collections.Generic
Imports Sys = System
Imports Tex = System.Text

Namespace Enhancements.Core.Logging
    ''' <summary>A type of configuration specific to FileSystemWriter instances, when multiple output files are intended.</summary>
    Public NotInheritable Class FileSystemWriterConfigurationMultipleFiles
        Inherits FileSystemWriterConfiguration

        ''' <summary>Initializes a FileSystemWriterConfigurationMultipleFiles instance, with default values.</summary>
        Public Sub New()
        End Sub
        ''' <summary>Initializes a FileSystemWriterConfigurationMultipleFiles instance, with some default values and others supplied.</summary>
        ''' <param name="_filePattern">FilePattern to use by the instance.</param>
        ''' <param name="_newFileCreationCriteriaBytesCount">NewFileCreationCriteriaBytesCount to use by the instance.</param>
        ''' <param name="_newFileCreationCriteriaWritesCount">NewFileCreationCriteriaWritesCount to use by the instance.</param>
        ''' <exception cref="IsNullException">_filePattern is null.</exception>
        ''' <exception cref="IsPathPartValidNotException">_filePattern is invalid.</exception>
        ''' <exception cref="IsInNotException">_filePattern does not contain the name/extension separator.</exception>
        ''' <exception cref="IsInNotException">_filePattern does not contain a TokenGenerator instance.</exception>
        ''' <exception cref="IsInRangeNotException">_newFileCreationCriteriaBytesCount is lower than 0.</exception>
        ''' <exception cref="IsInRangeNotException">_newFileCreationCriteriaWritesCount is lower than 0.</exception>
        Public Sub New(ByVal _filePattern As System.String, ByVal _newFileCreationCriteriaBytesCount As Sys.Int64, ByVal _newFileCreationCriteriaWritesCount As Sys.Int64)
            FilePattern = _filePattern
            NewFileCreationCriteriaBytesCount = _newFileCreationCriteriaBytesCount
            NewFileCreationCriteriaWritesCount = _newFileCreationCriteriaWritesCount
        End Sub
        ''' <summary>Initializes a FileSystemWriterConfigurationMultipleFiles instance.</summary>
        ''' <param name="_filePattern">FilePattern to use by the instance.</param>
        ''' <param name="_newFileCreationCriteriaBytesCount">NewFileCreationCriteriaBytesCount to use by the instance.</param>
        ''' <param name="_newFileCreationCriteriaWritesCount">NewFileCreationCriteriaWritesCount to use by the instance.</param>
        ''' <param name="_folder">Folder to use by the instance.</param>
        ''' <param name="_deleteOnStartup">DeleteOnStartup to use by the instance.</param>
        ''' <exception cref="IsNullException">_filePattern is null.</exception>
        ''' <exception cref="IsPathPartValidNotException">_filePattern is invalid.</exception>
        ''' <exception cref="IsInNotException">_filePattern does not contain the name/extension separator.</exception>
        ''' <exception cref="IsInNotException">_filePattern does not contain a TokenGenerator instance.</exception>
        ''' <exception cref="IsInRangeNotException">_newFileCreationCriteriaBytesCount is lower than 0.</exception>
        ''' <exception cref="IsInRangeNotException">_newFileCreationCriteriaWritesCount is lower than 0.</exception>
        ''' <exception cref="IsPathValidNotException">_folder is invalid.</exception>
        Public Sub New(ByVal _filePattern As System.String, ByVal _newFileCreationCriteriaBytesCount As Sys.Int64, ByVal _newFileCreationCriteriaWritesCount As Sys.Int64, ByVal _folder As System.String, ByVal _deleteOnStartup As System.Boolean)
            MyBase.New(_folder, _deleteOnStartup)
            FilePattern = _filePattern
            NewFileCreationCriteriaBytesCount = _newFileCreationCriteriaBytesCount
            NewFileCreationCriteriaWritesCount = _newFileCreationCriteriaWritesCount
        End Sub

        Private __FilePattern As System.String = "Enhancements.Core.Logging.File." + TokenGenerator.Guid.Value + ".xml"
        ''' <summary>Gets the file name generation pattern used by the instance. The default value is 'Enhancements.Core.Logging.File. + TokenGenerator.Guid.Value + .xml'.</summary>
        ''' <exception cref="IsNullException">The value is null (while setting).</exception>
        ''' <exception cref="IsPathPartValidNotException">The value is invalid (while setting).</exception>
        ''' <exception cref="IsInNotException">The value does not contain the name/extension separator (while setting).</exception>
        ''' <exception cref="IsInNotException">The value does not contain a TokenGenerator instance.</exception>
        Public Property FilePattern() As System.String
            Get
                Return __FilePattern
            End Get
            Private Set(ByVal _value As System.String)
                ___Assert.___IsNullNot("FilePattern._value", _value, True)
                ___Assert.___IsPathPartValid("FilePattern._value.TokenGenerator.___RemoveAllOccurrences(_value)", TokenGenerator.___RemoveAllOccurrences(_value), True)
                ___Assert.___IsIn("FilePattern._value", _value, "."c, True)
                ___Assert.___IsIn("FilePattern._value", _value, TokenGenerator.___AllValuesToArray(), True)

                __FilePattern = _value
            End Set
        End Property

        Private __NewFileCreationCriteriaBytesCount As Sys.Int64 = Sys.Int64.MaxValue
        ''' <summary>Gets and sets the current file size that triggers a new file generation used by the instance. The default value is 'System.Int64.MaxValue'.</summary>
        ''' <exception cref="IsInRangeNotException">The value is lower than 0 (while setting).</exception>
        Public Property NewFileCreationCriteriaBytesCount() As System.Int64
            Get
                Return __NewFileCreationCriteriaBytesCount
            End Get
            Set(ByVal _value As System.Int64)
                ___Assert.___IsInRange("NewFileCreationCriteriaBytesCount._value", _value, 0, Sys.Int64.MaxValue, True)

                __NewFileCreationCriteriaBytesCount = _value
            End Set
        End Property

        Private __NewFileCreationCriteriaWritesCount As Sys.Int64 = Sys.Int64.MaxValue
        ''' <summary>Gets and sets the current file writes count that triggers a new file generation used by the instance. The default value is 'System.Int64.MaxValue'.</summary>
        ''' <exception cref="IsInRangeNotException">The value is lower than 0 (while setting).</exception>
        Public Property NewFileCreationCriteriaWritesCount() As System.Int64
            Get
                Return __NewFileCreationCriteriaWritesCount
            End Get
            Set(ByVal _value As System.Int64)
                ___Assert.___IsInRange("NewFileCreationCriteriaWritesCount._value", _value, 0, Sys.Int64.MaxValue, True)

                __NewFileCreationCriteriaWritesCount = _value
            End Set
        End Property

    End Class
End Namespace
